import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 17:17
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            char[] T = t.toCharArray();
            int ans = 0;
            for (int i = 0; i < t.length(); i++) {
                // 已自身构成回文中心
                int len1 = expand(T, i, i);
                // 以两个单词构成回文扩展中心
                int len2 = expand(T, i, i + 1);
                ans = Math.max(ans, Math.max(len1, len2));
            }
            System.out.println(ans);
        }
    }
    public static int expand(char[] T, int left, int right) {
        while (left >= 0 && right < T.length && T[left] == T[right]) {
            --left;
            ++right;
        }
        return right - left - 1;
    }
}
